package all.com.jinyongqunxiax.modules;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;

import com.randy.fundation.Safe;

import all.com.jinyongqunxiax.R;
import androidx.appcompat.app.AppCompatActivity;

public class FolderPickerActivity extends AppCompatActivity {

    Options options;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.folder_picker_activity);
        options = new Options(getIntent());

        setTitle(Safe.val(options.title, "选择目录"));
    }

    static class Options {
        String  title;
        String  location;
        boolean pickFile;
        Options(Intent intent) {
            this.title = intent.getStringExtra("title");
            this.location = intent.getStringExtra("location");
            this.pickFile = intent.getBooleanExtra("pick-file", true);
        }

        public static Intent intent(Context context, String title, String startLocation, boolean pickFile) {
            Intent intent = new Intent(context, FolderPickerActivity.class);

            intent.putExtra("title", title);
            intent.putExtra("location", startLocation);
            intent.putExtra("pick-file", pickFile);
            return intent;
        }
    }
}
